<?php if ( ! defined('WDK_PATH')) exit('No direct script access allowed');?>
<!--{**************************************************************************}-->
<style>
.validated	{border:1px solid #117808;background-color: #BAFFA5;}
</style>
<!--{**************************************************************************}-->
<h1 class="title">정보 수정{# include user/menu.html #}</h1>
<form name="user_form" action="" method="POST" enctype="multipart/form-data">
<table class="form">
	<thead></thead>
	<colgroup>
		<col width="20%"/>
		<col width="30%"/>
		<col width="20%"/>
		<col width="30%"/>
	</colgroup>
	<tbody>
		<tr>
			<th>아이디</th>
			<td>{data.user_login_id} (Level : {session.user_group_level})</td>
			<th>이름</th>
			<td>{data.user_name}</td>
		</tr>
		<tr>
			<th>비밀번호</th>
			<td><input type="password" name="user_login_passwd" class="input"/></td>
			<th>비밀번호확인</th>
			<td><input type="password" name="confirm_passwd" class="input"/></td>
		</tr>
		<tr>
			<th>닉네임</th>
			<td>
				<input type="text" name="user_nick" class="input" value="{data.user_nick}"/>
				<a class="btn" id="btn_check_nick"/>중복체크</a>
			</td>
			<th>Email</th>
			<td>{data.user_email}</td>
		</tr>
		<tr>
			<th>생년월일</th>
			<td>
				<input type="text" name="user_birth_date[]" class="input" size="3" value="{data.user_birth_date1}"/>년
				<input type="text" name="user_birth_date[]" class="input" size="2" value="{data.user_birth_date2}"/>월
				<input type="text" name="user_birth_date[]" class="input" size="2" value="{data.user_birth_date3}"/>일
			</td>
			<th>이메일 인증</th>
			<td>
				<!--{?data.user_validate_time > 0}-->
				 <b>인증 완료</b> ({=date('Y-m-d', data.user_validate_time)})
				<!--{:}-->
				<a id="email_validate" class="btn">인증메일 발송</a>
				<!--{/}-->							
			</td>
		</tr>
		<tr>
			<th>일반전화</th>
			<td>
				<input type="text" name="user_phone[]" class="input" size="3" value="{data.user_phone1}"/> -
				<input type="text" name="user_phone[]" class="input" size="4" value="{data.user_phone2}"/> -
				<input type="text" name="user_phone[]" class="input" size="4" value="{data.user_phone3}"/>
			</td>
			<th>핸드폰</th>
			<td>
				<input type="text" name="user_mobile[]" class="input" size="3" value="{data.user_mobile1}"/> -
				<input type="text" name="user_mobile[]" class="input" size="4" value="{data.user_mobile2}"/> -
				<input type="text" name="user_mobile[]" class="input" size="4" value="{data.user_mobile3}"/>
			</td>
		</tr>
		<tr>
			<th>성별</th>
			<td>
				<input type="radio" name="user_sex" value="M" id="r1m"<!--{? data.user_sex == 'M'}--> checked="checked"<!--{/}-->/> <label for="r1m">남성</label>
				<input type="radio" name="user_sex" value="F" id="r1f"<!--{? data.user_sex == 'F'}--> checked="checked"<!--{/}-->/> <label for="r1f">여성</label>
			</td>
			<th>정보공개</th>
			<td>
				<input type="radio" name="user_info_public" value="T" id="r2m"<!--{? data.user_info_public == 'T'}--> checked="checked"<!--{/}-->/> <label for="r2m">공개</label>
				<input type="radio" name="user_info_public" value="F" id="r2f"<!--{? data.user_info_public == 'F'}--> checked="checked"<!--{/}-->/> <label for="r2f">비공개</label>			
			</td>
		</tr>
		<tr>
			<th>자기소개</th>
			<td colspan="3">
				<textarea name="user_memo" rows="4">{data.user_memo}</textarea>			
			</td>
		</tr>
		<tr>
			<th>가입일</th>
			<td>{=date('Y-m-d H:i:s', data.user_insert_time)}</td>
			<th>포인트</th>
			<td>{data.user_point}</td>
		</tr>
		<tr>
			<th>아이콘</th>
			<td colspan="3">
				<!--{? data.user_validate_time > 0 && session.user_group_level > 3}-->
				<input type="file" name="user_icon" value="{data.user_icon}" class="input"/> 
				<span> (75 x 22 크기의 15Kb 이하의 이미지(.gif)만 업로드 가능합니다.)</span></br>
				<!--{? data.user_icon }-->
				<input type="checkbox" name="remove_user_icon" value="T" id="c1"/><label for="c1">이미지 삭제</label>
				<img src="http://{config.file}{data.user_icon}" class="user_icon"/>
				<!--{/}-->
				<!--{:}-->
				이메일 인증을 완료하신 레벨 3이상의 회원만 가능합니다.
				<!--{/}-->
			</td>
		</tr>
		<tr>
			<th>이미지</th>
			<td colspan="3">
				<!--{? data.user_validate_time > 0 && session.user_group_level > 3}-->
				<input type="file" name="user_photo" value="{data.user_photo}" class="input"/> 
				<span> (100 x 100 크기의 30Kb 이하의 이미지(.gif, .jpg)만 업로드 가능합니다.)</span></br>
				<!--{? data.user_photo }-->
				<input type="checkbox" name="remove_user_photo" value="T" id="c2"/><label for="c2">이미지 삭제</label>
				<img src="http://{config.file}{data.user_photo}" class="user_photo"/>
				<!--{/}-->
				<!--{:}-->
				이메일 인증을 완료하신 레벨 3이상의 회원만 가능합니다.
				<!--{/}-->
			</td>
		</tr>
	</tbody>
	<tfoot>
		<tr>
			<td colspan="10">
				<div class="fl">
					<a id="btn_leave" class="btn" href="javascript:;">탈퇴</a>
				</div>
				<div class="fr">
					<a id="btn_edit" class="btn" href="javascript:;">수정</a>
				</div>
			</td>
		</tr>
	</tfoot>
</table>
</form>
<!--{**************************************************************************}-->
<script>
(function($){
	$('#btn_edit').click(function(){
		if($('form[name=user_form] :password[name=user_login_passwd]').val() != '' && $('form[name=join_form] :password[name=user_login_passwd]').val().length < 6)
		{
			alert('비밀번호는 6자 이상이여야 합니다.');
			return $('form[name=join_form] :password[name=user_login_passwd]').focus();
		}
		if($('form[name=user_form] :password[name=user_login_passwd]').val() != $('form[name=user_form] :password[name=confirm_passwd]').val())
		{
			alert('비밀번호와 비밀번호 확인이 일치하지않습니다.');
			$('form[name=user_form] :password[name=confirm_passwd]').val('');
			return $('form[name=user_form] :password[name=confirm_passwd]').focus();
		}
		if($('form[name=user_form] :text[name=user_nick]').val() == '')
		{
			alert('닉네임은 필수 입력사항입니다 .');
			return $('form[name=user_form] :text[name=user_nick]').focus();
		}
		if(confirm('수정하시겠습니까?'))
		{
			$('form[name=user_form]').submit();		
		}
	});
	$('#btn_check_nick').click(function(){
		$.post($PATH+'check', {'mode':'user_nick', 'val':$('form[name=user_form] :text[name=user_nick]').val()}, function(json){
			if(json.error)
			{
				$('form[name=user_form] :text[name=user_nick]').removeClass('validated');
				alert(json.msg);
				return;
			}
			$('form[name=user_form] :text[name=user_nick]').addClass('validated');
		}, 'json');
	});
	$('#btn_leave').click(function(){
		alert('준비중입니다.');
	});
		if(confirm('이메일 인증을 하시겠습니까?'))
		{
			$.post($PATH+'validation', {}, function(json){
				alert(json.msg);
			}, 'json');
		}
	});
})(jQuery);
</script>
<!--{**************************************************************************}-->